/**
 *  Copyright 2011 Pavlov Dm.
 *  Licensed under the MIT License
 */
 
package org.motiv.tests.policy;

import org.junit.Test;
import static org.junit.Assert.*;

import org.motiv.policy.FifoPolicy;
import org.motiv.core.Element;

/**
 * A cache fifo policy tests.
 * @author Pavlov Dm
 */

 public class FifoPolicyTest{
	@Test
	public void check_compareElemens_method() {
		final Element element_old = ElementFactory.create(1L,"first");
		try{
			Thread.sleep(100L);
		} catch(Exception ex){}
		final Element element_new = ElementFactory.create(2L,"second");
		assertTrue("check the second element is preferable to the first element",new FifoPolicy().compare(element_new,element_old));
	}
	@Test
	public void check_calculateSampleSize1_method() {
		final int EXPECTED_SIMPLE_SIZE = 10;
		assertEquals("check simple size",EXPECTED_SIMPLE_SIZE,new FifoPolicy().calculateSampleSize(10));
	}
	@Test
	public void check_calculateSampleSize2_method() {
		final int EXPECTED_SIMPLE_SIZE = 15;
		assertEquals("check simple size",EXPECTED_SIMPLE_SIZE,new FifoPolicy().calculateSampleSize(20));
	}
}